package com.example.test.config;

import com.example.test.mapper.CourseMapper;
import com.example.test.util.SpringUtils;
import com.sankuai.inf.leaf.service.SegmentService;
import com.sankuai.inf.leaf.service.SnowflakeService;
import org.apache.shardingsphere.spi.keygen.ShardingKeyGenerator;
import org.springframework.web.client.RestTemplate;

import java.util.Properties;

/**
 * @author
 * @description
 * @date 2021/12/8 16:48
 */
public class SimpleShardingKeyGenerator implements ShardingKeyGenerator{



    @Override
    public Comparable<?> generateKey() {
        SegmentService service = SpringUtils.getBean(SegmentService.class);
        return service.getId("leaf-segment-test").getId();

    }

    @Override
    public String getType() {
        return "zk";
    }

    @Override
    public Properties getProperties() {
        return null;
    }

    @Override
    public void setProperties(Properties properties) {

    }


}
